package com.lx.composetest

import android.annotation.SuppressLint
import android.app.Activity
import android.opengl.GLSurfaceView.EGLConfigChooser
import android.os.Bundle
import android.view.SurfaceView
import android.widget.LinearLayout
import cn.xdf.lib_davinci.core.widget.builder.DavinciBuilder
import cn.xdf.lib_davinci.core.widget.builder.Motions
import com.lx.composetest.lowlatency.BezierInkSurfaceView
import com.lx.composetest.lowlatency.InkSurfaceView
import javax.microedition.khronos.egl.EGL10


class LowLatencyActivity : Activity() {

    lateinit var sv: SurfaceView

    @SuppressLint("NewApi")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)


        val surfaceView = BezierInkSurfaceView(this)
        val linearLayout = LinearLayout(this)
        linearLayout.orientation = LinearLayout.HORIZONTAL
        surfaceView.layoutParams =
            (LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT)).apply {
                this.weight = 1f
            }
        val davinci = DavinciBuilder(this)
            .addMotion(Motions.PEN)
            .build()
        davinci.layoutParams =
            (LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT)).apply {
                this.weight = 1f
            }
        linearLayout.addView(surfaceView)
        linearLayout.addView(davinci)
        setContentView(linearLayout)
    }
}